﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Origin2.Core;
using Origin2.Framework;
using Origin2.Framework.Managers;
using XNAssist;

namespace Origin2Test.Controls
{
    public class NineTileDrawControl : Control
    {
        private const int Width = 256, Height = 256;

        private readonly NineTile _nineTile;

        public NineTileDrawControl(IControllable parent) : base(parent)
        {
            _nineTile = new NineTile(AssetManager.GetContent<Texture2D>("LeTesture"), 256, 256, 0.25f);
        }

        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            var obj = (GameObject) Parent;

            _nineTile.Draw(spriteBatch, obj.Transform.Position, Width, Height, Color.White);
        }
    }
}
